package com.qi.spzx.manager.mapper;

import com.qi.spzx.model.entity.product.ProductSpec;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2024/2/23 18:30
 * @Version 1.0.0
 */
@Mapper
public interface ProductSpecMapper {


    @Select("select * from product_spec where is_deleted = 1 order by id desc")
    List<ProductSpec> selectAll();

    @Insert("insert into product_spec value(null,#{specName},#{specValue},now(),now(),1)")
    void save(ProductSpec productSpec);

    void updateById(ProductSpec productSpec);

    @Update("update product_spec set is_deleted = 0 , update_time = now() where id = #{id}")
    void deleteById(Long id);

    @Select("select * from product_spec where is_deleted = 1 order by id desc")
    List<ProductSpec> findAll();

}
